Unwanted prefix of "Copy of " added to file name of opened Excel attachments

How can I stop the prefix of "Copy of " from being added to the file name when I save an Excel file that was mailed as an attachment?  

It is very annoying to have to keep deleting that unwanted addition to my filenames.  

December 12th, 2011 9:22pm

1) Don't open attachments - save them first and then open them.

2) You can use this code in the ThisWorkbook object of your Personal.xls:

Private WithEvents App As Application

Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If InStr(1, Wb.Name, "Copy of ") = 1 Then
        Application.EnableEvents = False
        Cancel = True
        Wb.SaveAs Replace(Wb.FullName, "Copy of ", "")
        Application.EnableEvents = True
    End If
End Sub

Private Sub Workbook_Open()
    Set App = Application
End Sub

 

Free Windows Admin Tool Kit Click here and download it now
December 13th, 2011 5:22pm

Thanks, Bernie.   I was almost hoping someone would tell me I was an idiot for not finding the obvious setting in Options to turn off this "helpful" feature.  I'm a little annoyed with Microsoft for tampering with my filenames. 

I'll give your App_WorkbookBeforeSave code a try. 

Dory O.

December 14th, 2011 1:08pm

IIRC, email attachments are first stored in a read-only directory, so by default opening them directly causes the application to work on a "Copy of" the file, and the name is changed to reflect that.
Free Windows Admin Tool Kit Click here and download it now
December 14th, 2011 1:34pm

Actually, Dory0, there is a way to turn this off simply.

Open Outlook 2010

Click on File

Click on Options

Click on Trust Center

Click on Trust Center Settings button

Click on Attachment Handling

Click on Turn Off Attachment Preview

This will also turn off that annoying preview function that kicks in every time you single-click on an attachment name.

  • Proposed as answer by ritpg Wednesday, May 09, 2012 3:10 PM
May 9th, 2012 3:09pm

Actually, Dory0, there is a way to turn this off simply.

Open Outlook 2010

Click on File

Click on Options

Click on Trust Center

Click on Trust Center Settings button

Click on Attachment Handling

Click on Turn Off Attachment Preview

This will also turn off that annoying preview function that kicks in every time you single-click on an attachment name.

  • Proposed as answer by ritpg Wednesday, May 09, 2012 3:10 PM
Free Windows Admin Tool Kit Click here and download it now
May 9th, 2012 3:09pm

Thanks!  This works for both issues and is far easier than adding a macro.
March 6th, 2013 9:33pm

I noticed that this did stop the preview function, but if I open the file from the email and then attempt to save it, the notorious "Copy of" prefix still inserted itself...

Free Windows Admin Tool Kit Click here and download it now
October 17th, 2014 5:00pm

Where is Personal.xls?  What is a ThisWorkbook?  I am not a programmer.  Just a user.
May 15th, 2015 12:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics